package org.bitterorange.flansmodslain.minecraft;

import java.lang.reflect.Method;
import java.util.logging.Logger;

public class Minecraft {
    private static final Class<?> ItemClass;

    static {
        Class<?> itemClass;
        Method itemGetItemByIdMethod;
        try {
            itemClass = Class.forName("net.minecraft.item.Item");
        } catch (Exception e) {
            itemClass = null;
            Logger.getGlobal().warning("§cMinecraft 核心交互模块加载失败！");
            e.printStackTrace();
        }
        ItemClass = itemClass;
    }

    public static Object getItemById(int id) throws Exception {
        // net.minecraft.item.Item.func_150899_d(int)
        return ItemClass.getMethod("func_150899_d", int.class).invoke(null, id);
    }
}
